"""mock_2021 URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django import views
from django.contrib import admin
from django.contrib.auth.decorators import login_required
from django.urls import path, include, re_path
from django.views.generic import TemplateView

from mock.views import Mock_server, Server_list, Add_server, Router_list, Reponse_list, Add_router, Add_Response, \
    Edit_info, Delete_info, Edit_router, Delete_router, Edit_response, Delete_response
from users.views import LoginView, RegisterView, ActiceUserView

urlpatterns = [
    path('admin/', admin.site.urls),
    # path('login',TemplateView,as_view(template))
    # 基于方法实现
    # path('login/',user_login,name='login')
    # 基于类视图实现
    path('login/',LoginView.as_view(),name='login'),
    # register
    path('register/',RegisterView.as_view(),name='register'),
    # 验证码
    path('captcha/',include('captcha.urls')),
    re_path('active/(?P<active_code>.*/$)',ActiceUserView.as_view(),name='active'),

    re_path('mock/(?P<api_server>.*?)/(?P<api_router>.*)',Mock_server.as_view(),name='mock'),
    # 服务器列表
    path('serverlist',Server_list.as_view(),name='server_list'),
    # 添加服务器
    path('add_server',Add_server.as_view(),name='add_server'),
    # 路由列表
    path('routerlist',Router_list.as_view(),name='router_list'),
    # 添加路由
    path('add_router',Add_router.as_view(),name='add_router'),
    # 响应列表
    path('reponselist',Reponse_list.as_view(),name='response_list'),
    # 添加相应
    path('add_response',Add_Response.as_view(),name='add_response'),
    # 编辑服务器信息
    path('editInfo/<id>/',Edit_info.as_view(),name='editInfo'),
    # 删除服务信息确认
    path('deleteInfo/<id>/',Delete_info.as_view(),name='deleteInfo'),
    # 编辑路由信息
    path('editrouter/<id>/',Edit_router.as_view(),name='editrouter'),
    # 删除路由信息确认
    path('delrouter/<id>/',Delete_router.as_view(),name='delrouter'),
    # 编辑响应信息
    path('editresponse/<id>/',Edit_response.as_view(),name='editresponse'),
    # 删除响应信息确认
    path('delresponse/<id>/',Delete_response.as_view(),name='delresponse'),
    # path('searchlist/',views.search,name='search')

]
